package com.hjx.objectassert.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.hjx.objectassert.ObjectUtil;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Pattern;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

/**
 * 银行实体类
 * 
 * @author xuyiming
 *
 */
public class CreditCardAllData {
	
	
	/**
	 * 银行卡ID
	 */
	@Pattern(regexp = "[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}", message = "银行卡ID")
	@JSONField(name="card_id")
	private String cardId;
	/**
	 * 银行卡类型.借记卡或信用卡
	 */
	@Pattern(regexp = "信用卡|借记卡|", message = "固定值：借记卡/信用卡")
	@JSONField(name="card_type")
	private String cardType;
	/**
	 * 银行名称
	 */
	//@Size(max = 64, message = "固定值：XX银行")
	//@JSONField(name="bank_name")
	private String bankName;
	/**
	 * 完整卡号
	 */
	//@Pattern(regexp = "[\\d,\\*]+(?<!,)$|", message = "卡号（不带空格）")
	//@JSONField(name="full_card_num")
	private String fullCardNum;
	/**
	 * 卡号后4位
	 */
	//@Pattern(regexp = "[\\d,\\*]+(?<!,)$|", message = "卡号后四位")
	//@JSONField(name="card_num")
	private String cardNum;
	/**
	 * 持卡人
	 */
	//@Size(max = 32, message = "持卡人")
	//@JSONField(name="name_on_card")
	private String nameOnCard;
	/**
	 * 借记卡余额/信用卡可用额度
	 */
	private BigDecimal balance = null;
	/**
	 * 信用卡现金可用额度
	 */
	//@JSONField(name="cash_balance")
	private BigDecimal cashBalance = null;
	/**
	 * 信用卡现金额度
	 */
	//@JSONField(name="cash_limit")
	private BigDecimal cashLimit = null;
	/**
	 * 信用卡额度
	 */
	//@JSONField(name="credit_limit")
	private BigDecimal creditLimit = null;
	/**
	 * 开户银行
	 */
	//@Size(max = 256, message = "开户银行")
	//@JSONField(name="open_bank")
	private String openBank;
	/**
	 * 开卡时间.格式yyyy-MM-dd
	 */
//	//@Pattern(regexp = "^\\d{4}-\\d{2}-\\d{2}$|", message = "开卡时间.格式yyyy-MM-dd")
//	//@Pattern(regexp = "^(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$|")
	//@JSONField(format="yyyy-MM-dd",name="open_time")
	private Date openTime;

	//@Valid
	private List<CreditCardTimeDeposit> deposits = new ArrayList<CreditCardTimeDeposit>();

	//@Valid
	private List<BillAllData> bills = new ArrayList<BillAllData>();

	/**
	 * 银行卡ID
	 *
	 * //@return
	 */
	public String getCardId() {
		return cardId;
	}

	/**
	 * 银行卡ID
	 * 
	 * //@param cardId
	 */
	public void setCardId(String cardId) {
		this.cardId = cardId;
	}

	/**
	 * 银行卡类型.借记卡或信用卡
	 *
	 * //@return
	 */
	public String getCardType() {
		return cardType;
	}

	/**
	 * 银行卡类型.借记卡或信用卡
	 * 
	 * //@param cardType
	 */
	public void setCardType(String cardType) {
		this.cardType = cardType;
	}

	/**
	 * 银行名称
	 *
	 * //@return
	 */
	public String getBankName() {
		return bankName;
	}

	/**
	 * 银行名称
	 * 
	 * //@param bankName
	 */
	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	/**
	 * 完整卡号
	 *
	 * //@return
	 */
	public String getFullCardNum() {
		return fullCardNum;
	}

	/**
	 * 完整卡号
	 * 
	 * //@param fullCardNum
	 */
	public void setFullCardNum(String fullCardNum) {
		this.fullCardNum = fullCardNum;
	}

	/**
	 * 卡号后4位
	 *
	 * //@return
	 */
	public String getCardNum() {
		return cardNum;
	}

	/**
	 * 卡号后4位
	 * 
	 * //@param cardNum
	 */
	public void setCardNum(String cardNum) {
		this.cardNum = cardNum;
	}

	/**
	 * 持卡人
	 *
	 * //@return
	 */
	public String getNameOnCard() {
		return nameOnCard;
	}

	/**
	 * 持卡人
	 * 
	 * //@param nameOnCard
	 */
	public void setNameOnCard(String nameOnCard) {
		this.nameOnCard = nameOnCard;
	}

	/**
	 * 借记卡余额/信用卡可用额度
	 *
	 * //@return
	 */
	public BigDecimal getBalance() {
		return balance;
	}

	/**
	 * 借记卡余额/信用卡可用额度
	 * 
	 * //@param balance
	 */
	public void setBalance(BigDecimal balance) {
		this.balance = balance;
	}

	/**
	 * 信用卡现金可用额度
	 *
	 * //@return
	 */
	public BigDecimal getCashBalance() {
		return cashBalance;
	}

	/**
	 * 信用卡现金可用额度
	 * 
	 * //@param cashBalance
	 */
	public void setCashBalance(BigDecimal cashBalance) {
		this.cashBalance = cashBalance;
	}

	/**
	 * 信用卡现金额度
	 *
	 * //@return
	 */
	public BigDecimal getCashLimit() {
		return cashLimit;
	}

	/**
	 * 信用卡现金额度
	 * 
	 * //@param cashLimit
	 */
	public void setCashLimit(BigDecimal cashLimit) {
		this.cashLimit = cashLimit;
	}

	/**
	 * 信用卡额度
	 *
	 * //@return
	 */
	public BigDecimal getCreditLimit() {
		return creditLimit;
	}

	/**
	 * 信用卡额度
	 * 
	 * //@param creditLimit
	 */
	public void setCreditLimit(BigDecimal creditLimit) {
		this.creditLimit = creditLimit;
	}

	/**
	 * 开户银行
	 *
	 * //@return
	 */
	public String getOpenBank() {
		return openBank;
	}

	/**
	 * 开户银行
	 * 
	 * //@param openBank
	 */
	public void setOpenBank(String openBank) {
		this.openBank = openBank;
	}

	/**
	 * 开卡时间.格式yyyy-MM-dd
	 *
	 * //@return
	 */
	public Date getOpenTime() {
		return openTime;
	}

	/**
	 * 开卡时间.格式yyyy-MM-dd
	 * 
	 * //@param openTime
	 */
	public void setOpenTime(Date openTime) {
		this.openTime = openTime;
	}

	public List<CreditCardTimeDeposit> getDeposits() {
		return deposits;
	}

	public void setDeposits(List<CreditCardTimeDeposit> deposits) {
		this.deposits = deposits;
	}

	public List<BillAllData> getBills() {
		return bills;
	}

	public void setBills(List<BillAllData> bills) {
		this.bills = bills;
	}

    @Override
    public boolean equals(Object except) {
        return ObjectUtil.equals(this.getClass(), this, except);
    }

    @Override
    public String toString(){
        return ObjectUtil.toString(this.getClass(), this);
    }

}
